package com.suzus.seven;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.suzus.utils.RabbitMqUtils;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class TopicLog {

    public static final String EXCHANGE_NAME="topic_logs";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();

        Map<String,String>bindingKeyMap=new HashMap<>();
        bindingKeyMap.put("lazy.brown.fox","1");
        bindingKeyMap.put("quick.orange.fox","2");
        bindingKeyMap.put("lazy.orange.elephant","3");
        bindingKeyMap.put("quick.orange.rabbit","4");

        channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.TOPIC);

        for (Map.Entry<String, String> stringStringEntry : bindingKeyMap.entrySet()) {
            String key = stringStringEntry.getKey();
            String value = stringStringEntry.getValue();

            channel.basicPublish(EXCHANGE_NAME,key,null,value.getBytes(StandardCharsets.UTF_8));
        }



    }

}
